//
//  DXWMineCell.m
//  pandaTV
//
//  Created by 淡馨慰 on 16/10/8.
//  Copyright © 2016年 淡馨慰. All rights reserved.
//

#import "DXWMineCell.h"
#import "DXWMineRowItem.h"
#import "DXWMineArrowItem.h"
#import "DXWMineArrowLoginItem.h"

@implementation DXWMineCell

/** 初始化mineCell */
+ (instancetype)cellWithTableView:(UITableView *)tableView style:(UITableViewCellStyle)style
{
    static NSString *ID = @"mineCell";
    DXWMineCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    if (cell == nil) {
        cell = [[self alloc]initWithStyle:style reuseIdentifier:ID];
    }
    return cell;
}

- (void)setRowItem:(DXWMineRowItem *)rowItem
{
    _rowItem = rowItem;
    //设置cell的内容
    [self setDataWithRowItem:rowItem];
    //设置右侧辅助视图
    [self setAccessoryViewWithRowItem:rowItem];
}
//设置cell的内容
- (void)setDataWithRowItem:(DXWMineRowItem *)rowItem
{
    //标准型
    if ([rowItem isKindOfClass:[DXWMineArrowItem class]]) {
        self.textLabel.text = rowItem.title;
        self.textLabel.font = [UIFont systemFontOfSize:15];
        self.imageView.image = rowItem.image;
    }
    //登录型
    else if ([rowItem isKindOfClass:[DXWMineArrowLoginItem class]])
    {
    self.textLabel.text = rowItem.title;
    self.textLabel.font = [UIFont systemFontOfSize:15];
    self.textLabel.textColor = dxw_MainColor;
    self.textLabel.textAlignment = NSTextAlignmentRight;
    self.imageView.image = rowItem.image;
    }

}
//设置右侧辅助视图
- (void)setAccessoryViewWithRowItem:(DXWMineRowItem *)rowItem
{
    //标准型
    if ([rowItem isKindOfClass:[DXWMineArrowItem class]]) {
    self.accessoryView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"arrow_right"]];
    }
    //登录型
    else if ([rowItem isKindOfClass:[DXWMineArrowLoginItem class]])
    {
    self.accessoryView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"arrow_right2"]];
    }
}

@end
